<?php

// Acceso restringido
defined('JL') or die('Acceso restringido');

class AdministrationModel extends JLModelBase {
    /**
     * Funcion que retorn Sections
     * @Retorna bool
     */

    /**
     * AdministrationModel::getAdministration()
     * 
     * @param int $id
     * @return array
     */
    public function getAdministration($id=1) {
        $_true = null;

        $sql = "SELECT 
          `txt_presentation_admin`
        FROM 
          `tbl_administration`
        WHERE 
          `int_id_administration` = " . $this->DB->Quote($id) . "";

        $this->DB->executeQuery($sql);

        if ($this->DB->getRowsAffected() > 0) {
            $_true = $this->DB->getDataArray();
            $_true = $_true[0];
        }

        return $_true;
    }

    /**
     * AdministrationModel::UpdatePresentation()
     * 
     * @param int $int_id_sections_view
     * @param string $txt_desc_presentation
     * @return bool
     */
    function UpdatePresentation($int_id_administration=1, $txt_presentation_admin) {
        $_true = false;

        $sql = "UPDATE 
              `tbl_administration`  
            SET 
              `txt_presentation_admin` = " . $this->DB->Quote($txt_presentation_admin) . "
            WHERE 
              `int_id_administration` = " . $this->DB->Quote($int_id_administration) . "";

        $this->DB->executeQuery($sql);

        if ($this->DB->getRowsAffected() > 0) {
            $_true = true;
        }

        return $_true;
    }

    /**
     * SectionViewModel::UpdateAdhesion()
     * 
     * @param int $int_id_sections_view
     * @param string $txt_desc_adhesion
     * @return bool
     */
    function UpdateAdhesion($int_id_sections_view, $txt_desc_adhesion) {
        $_true = false;

        $sql = "UPDATE 
              `tbl_sections_view`  
            SET 
              `txt_desc_adhesion` = " . $this->DB->Quote($txt_desc_adhesion) . "
            WHERE 
              `int_id_sections_view` = " . $this->DB->Quote($int_id_sections_view) . "";

        $this->DB->executeQuery($sql);

        if ($this->DB->getRowsAffected() > 0) {
            $_true = true;
        }

        return $_true;
    }

}